/*
 * IntArray
 * 
 * Version information:1.0
 *
 * Date: 25/11/2012
 */

/**
 * @author dv11rlm
 */
public class IntArray {

    private int[] array;
    private int size;

    /**
     * initialize variables.
     * 
     * @param size
     */
    public IntArray(int size) {
	array = new int[size];
	this.size = size;
    }

    /**
     * return array.
     * 
     * @return
     */
    public int[] getArray() {
	return array;
    }

    /**
     * returns integer at position if it's valid.
     * 
     * @param pos
     * @return
     */
    public int getIntegerAtPosition(int pos) {
	if (pos >= 0 && pos < size) {
	    return array[pos];
	} else {
	    throw new IndexOutOfBoundsException();
	}
    }

    /**
     * return size.
     * 
     * @return
     */
    public int getSize() {
	return size;
    }

    /**
     * Set value to position.
     * 
     * @param pos
     * @param value
     */
    public void setValueAt(int pos, int value) {
	array[pos] = value;
    }
}
